package com.example.lenovo.test01;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Layout;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

public class UC1 extends AppCompatActivity {

    private Button btn_back;
    private Button btn1;
    private Button btn2;
    private Button btn3;
    private LinearLayout l1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_uc1);

        btn_back=findViewById(R.id.btn_return1);
        btn_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =new Intent(UC1.this,MainActivity.class);
                startActivity(intent);
            }
        });

        l1=findViewById(R.id.ll_1);
        btn1=findViewById(R.id.button1);
        btn1.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                l1.setOrientation(LinearLayout.HORIZONTAL);
                l1.setGravity(Gravity.CENTER);
            }
        });
        btn2=findViewById(R.id.button2);
        btn2.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                l1.setOrientation(LinearLayout.VERTICAL);
                l1.setGravity(Gravity.CENTER);
            }
        });
        btn3=findViewById(R.id.button3);
        btn3.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                l1.setGravity(Gravity.CENTER_VERTICAL|Gravity.LEFT);
            }
        });

    }

}
